<!DOCTYPE html>
<html lang="zh" xmlns:th="https://www.thymeleaf.org">
<head th:replace="admin/_fragments :: head(~{::title})">
    <meta charset="UTF-8">
    <title>新增标签</title>
</head>

<body>

<!--中间-->

<div class="admin-content-container padded-nomal ">

    <div class="ui container">
        <form action="#" method="POST" class="ui form" th:object="${tag}"
              th:action="*{id}==null ? @{/admin/saveTag} : @{/admin/updateTags/{id}(id=*{id})}">

            <input type="hidden" name="id" th:value="*{id}">
            <div class="required field">
                <div class="ui left labeled input">
                    <label class="ui blue basic label">分类：</label>
                    <input type="text" name="name" placeholder="分类名称" th:value="*{name}">
                </div>

            </div>

            <div class="ui error message"></div>
            <div class="ui mini negative message" th:unless="${#strings.isEmpty(msg)}" th:text="${msg}"></div>


            <div class="ui right aligned container">
                <button type="button" class="ui button" onclick="window.history.go(-1)">返回</button>
                <input type="submit" class="ui button" value="提交">

            </div>
        </form>


    </div>


</div>

</body>
<!-- 页面jQuery.js的引用位置问题,如果导入了其它与jquery有关的js文件,那么jquery.js须在其它js的前面 -->
<script th:src="@{/js/jquery.min.js}"></script>
<script th:src="@{/js/semantic.min.js}"></script>
<script th:src="@{/js/main.js}"></script>

<script>

    //初始化Markdown编辑器
    var contentEditor;
    $(function () {
        contentEditor = editormd("md-content", {
            width: "100%",
            height: 640,
            syncScrolling: "single",
//        path    : "../static/lib/editormd/lib/"
            path: "../static/lib/editormd/lib/"
        });
    });


    $("#menu-btn").click(function () {
        $(".menu-item").toggleClass("mobile-hide")
    });

    //下拉菜单
    $('#dropdownmenu').dropdown({
        on: 'hover'
    });

    //类型选择    
    $('.ui.selection.dropdown')
        .dropdown({
            maxSelections: 3
        })
    ;


    $('.ui.form').form({
        fields: {
            name: {
                identifier: 'name',
                rules: [{
                    type: 'empty',
                    prompt: '请输入类型名称'
                }]
            },
        }
    });

    //消息关闭
    $('.message .close')
        .on('click', function () {
            $(this).closest('.message').transition('fade');
        });

</script>
</body>
</html>